﻿using System;
using System.Windows;

namespace ComicTool
{
    public partial class App : Application
    {

        public App()
        {
            this.Startup += this.Application_Startup;
            this.Exit += this.Application_Exit;
            this.UnhandledException += this.Application_UnhandledException;

            InitializeComponent();
        }

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            this.RootVisual = new MainPage();
        }

        private void Application_Exit(object sender, EventArgs e)
        {

        }

        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            e.Handled = true;
            Deployment.Current.Dispatcher.BeginInvoke(delegate
            {
                ErrorDialog ed = new ErrorDialog(e.ExceptionObject.ToString());
                ed.Show();
            });
        }
    }
}
